<?php

class Controller_Admin_Product_Category_Create extends Controller_Admin_Abstract
{
	function execute($request)
	{

		$form = new Form_Admin_Product_Category_Create;
		
		if ($request -> isPost() && $form -> isValid($_POST))
		{
			$data = $form -> getValues();
		
			$cat = Mongo_Document::factory('productcategory');

			$cat -> _id = $data['_id'];
			$cat -> name = $data['name'];
			$cat -> title = $data['title'];
			$cat -> meta_keywords = $data['meta_keywords'];
			$cat -> meta_title = $data['meta_title'];
			$cat -> meta_description = $data['meta_description'];

			$cat -> save();

			Agilet::redirect('admin/product/category', null, null);
		}

		$request -> response = View::render($data = array('form' => $form), $script = 'controller/admin/edit.tpl');
	}

}
